<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <style type="text/css">
    ul,p{text-align: center;}
    li{
        color:#666;font-size:14px;margin:0 10px;list-style: none;display:inline-block;
    }
    </style>

    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>

    <title>倒计时</title>
</head>

<body>
    <ul>
        <li class="cutDay">00</li>天
        <li class="cutHour">00</li>时
        <li class="cutMinute">00</li>分
        <li class="cutSecond">00</li>秒
    </ul>
    <p>结束时间：2019/06/11 11:00:00</p>    
   
    <script>
        //倒计时
        function countDown(timesObj,dayObj,hourObj,minuteObj,secondObj) {
            var timesNow = new Date().getTime();//当前
            var timesEnd = new Date(timesObj); //结束  
            var times=(timesEnd-timesNow)/1000;
            console.log(timesNow+'最后'+timesEnd+'差值'+times);
            var timer = null;
            timer = setInterval(function () {
                var day = 0,
                    hour = 0,
                    minute = 0,
                    second = 0;
                if (times > 0) {
                    day = Math.floor(times / (60 * 60 * 24));
                    hour = Math.floor(times / (60 * 60)) - (day * 24);
                    minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
                    second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
                }
                if (day <= 9) day = '0' + day;
                if (hour <= 9) hour = '0' + hour;
                if (minute <= 9) minute = '0' + minute;
                if (second <= 9) second = '0' + second;
                $(dayObj).html(day);
                $(hourObj).html(hour);
                $(minuteObj).html(minute);
                $(secondObj).html(second);
                times--;
            }, 1000);
            if (times <= 0) {
                clearInterval(timer);
            }
        }
        countDown("2019/06/11 11:00:00",".cutDay",".cutHour",".cutMinute",".cutSecond");
    </script>
</body>

</html>